<template>
  <div class="topic">
    <div class="title-holder">
      <div class="title">专题精选 <span class="icon"></span></div>
    </div>
    <div class="list-holder">
      <ul class="list">
        <li
          class="item"
          v-for="item in $store.state.home.topicList"
          :key="item.id"
          @click="toTopic(item.id)"
        >
          <img :src="item.scene_pic_url" alt="" />
          <div class="text-left">
            <p class="title">{{ item.title }}</p>
            <p class="desc">{{ item.subtitle }}</p>
          </div>
          <p class="price">{{ item.price_info }}元起</p>
        </li>
      </ul>
    </div>
  </div>
</template>

<script>
export default {
  methods: {
    toTopic(id) {
      this.$router.push({ path: "/pages/topic/detail", query: { id } });
    },
  },
};
</script>

<style lang="scss">
.topic {
  margin-top: 8px;
  background-color: #fff;
  .title-holder {
    padding: 18px;
    .title {
      text-align: center;
      line-height: 16px;
      .icon {
        vertical-align: middle;
        display: inline-block;
        width: 16px;
        height: 16px;
        background: url("../../assets/images/right.png") no-repeat center;
      }
    }
  }

  .list-holder {
    margin-top: 8px;
    .list {
      overflow: auto;
      height: 250px;
      white-space: nowrap;
      .item {
        display: inline-block;
        margin-left: 12.5px;
        width: 290px;
        height: 98%;
        box-sizing: border-box;
        img {
          display: block;
          width: 287px;
          height: 162px;
          margin: 0 auto;
        }
        p {
          width: 100%;
        }
        .text-left {
          float: left;
          width: 85%;
          p {
            text-overflow: ellipsis;
            overflow: hidden;
            white-space: nowrap;
          }
          .title {
            font-size: 15px;
            font-weight: 700;
            margin-top: 4px;
          }
          .desc {
            margin-top: 12px;
            color: #8a8a8a;
          }
        }
        .price {
          float: left;
          width: 15%;
          margin-top: 4px;
          color: #9c3232;
        }
      }
    }
  }
}
</style>